package com.ldp.designpatterns.study.factory.simpleFactory.factory;

import com.ldp.designpatterns.study.factory.simpleFactory.impl.AmericanCoffee;
import com.ldp.designpatterns.study.factory.simpleFactory.impl.LatterCoffe;
import com.ldp.designpatterns.study.factory.simpleFactory.service.Coffee;

/**
 * @ClassName ShapeFactory
 * @Description 简单工厂模式——步骤3:创建一个咖啡工厂，生成基于给定信息的实体类的对象。
 * @Author lindipei
 * @Date 2023/10/13 11:04
 */
public class CoffeeFactory {

    public Coffee getShape(String coffeeType){
        if(coffeeType == null){
            return null;
        }
        if(coffeeType.equalsIgnoreCase("American")){
            return new AmericanCoffee();
        } else if(coffeeType.equalsIgnoreCase("RECTANGLE")){
            return new LatterCoffe();
        }
        return null;

    }
}
